package com.itheima.edu.info.manager.entry;


import com.itheima.edu.info.manager.domain.Student;
import com.itheima.edu.info.manager.thread.StudentRunnable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

//项目的启动引擎类,未来整个项目的启动入口就放在这个类里
public class ServerEntry {
    private static final Logger LOGGER = LoggerFactory.getLogger(ServerEntry.class);

    public static void main(String[] args) throws IOException {

        LOGGER.info("服务器端启动了");
        ServerSocket serverSocket = new ServerSocket(10000);
        while (true) {
            Socket socket = serverSocket.accept();
            LOGGER.info("服务器连接成功...........");
            StudentRunnable studentRunnable = new StudentRunnable(socket);
            ExecutorService executorService = Executors.newFixedThreadPool(10);
            executorService.submit(studentRunnable);


        }


    }
}